<#include "../inc/view.html"/>
<@view>
            <form id="articleAddForm${nowtime}" name="articleAddForm" class="" action="/admin/article/save" method="post" data-validator-option="{theme:'yellow_top'}">
                <input type="hidden" name="article.id" value="${(po.id)!}">
            <div class="row">
                <div class="col-sm-6">
                    <ol class="breadcrumb">
                        <li>
                            <b>系统</b>
                        </li>
                        <li>
                            <a href="javascript:void(0);" onclick="contentLoadPage('/article')">文章</a>
                        </li>
                        <li class="active">
                            <#if po??>修改
                                <#else>新增
                            </#if>
                        </li>
                    </ol>
                </div>
                <div class="col-sm-6">
                    <a onclick="contentLoadPage('/article')" class="btn-sm btn-white pull-right" style="margin-left:10px;"><i class="ti-arrow-left"></i>返回</a>
                    <button type="submit" class="btn-sm btn-success pull-right"><i class="ti-save"></i>保存</button>
                </div>
            </div>
            <hr>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">文章类别</label>
                            <div class="col-md-4">
                                <select class="select2 form-control" id="articleCate" name="article.cate_id">
                                    <#if cateList??>
                                    <#list cateList as r>
                                        <option value="${r.id}" <#if (po.cate_id)?? && r.id==(po.cate_id)!>selected</#if>>${r.name}</option>
                                    </#list>
                                    </#if>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">状态</label>
                            <div class="col-md-4">
                                <label><input type="radio" name="article.status" value="1" <#if 1==(po.status)!0 >checked</#if> /> 已发布</label>
                                <label><input type="radio" name="article.status" value="0" <#if 2==(po.status)!0 >checked</#if> />未发布</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">标题</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="article.title" maxlength="100" data-rule="标题:required" value="${(po.title)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">子标题</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="article.sup_title" maxlength="100" value="${(po.sup_title)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">图片</label>
                            <div class="col-md-10">
                                <input type="text" class="form-control" name="article.img" maxlength="100" value="${(po.img)!}">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">摘要</label>
                            <div class="col-md-10">
                                <script id="summary_editor${nowtime}" type="text/plain" name="article.summary" style="width:99%;height:200px;">${(po.summary)!}</script>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-md-2 control-label">正文内容</label>
                            <div class="col-md-10">
                                <script id="content_editor${nowtime}" type="text/plain" name="article.content" style="width:99%;height:500px;">${(po.content)!}</script>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
</@view>
<script>
    $(function(){
        $(".select2").select2();
        var content_editor$ = UE.getEditor('content_editor${nowtime}');
        var summary_editor$ = UE.getEditor('summary_editor${nowtime}');
            ajaxForm($("#articleAddForm${nowtime}"),function(json){
            if(json.code==RESULT_SUCCESS){
                contentLoadPage('/article');
            }else{
                if(json.msg)
                    layer.alert(json.msg,{icon:5,title:'系统提示',shadeClose:true});
            }
        });
    });
</script>